package com.slcf.util;

import java.util.Date;

import org.apache.commons.codec.Charsets;

import com.google.common.hash.Hashing;

public class test {
	public static void main(String[] args) {
		//HttpUtil.sendPostUrl("http://localhost/calfTrader-traderCenter-api/financeMessage/finaMenologyFind.do", "currentPage=1&newsDate=20170205", "utf-8");
//		for (int i = 0; i < 50; i++) {
//			String result = HttpUtil.sendGet("http://140.207.168.154:8088/tpp/wd/sendMessage?loanTerm=14&loanType=善真贷", "utf-8");
//			System.out.println(result);
//		}
		String result1 = "";
		for (int i = 0; i < 500; i++) {
			String loanNo = "YZ-TEST1-" + new Date().getTime();
			String tradeCode = "TRADE-TEST1-" + new Date().getTime();
			// 4、验签错误 md5(Key+ companyName + effectDate +  requestTime)
			String hashString = "7149D7A3EDE945F54A87D1F49C8979ED" + loanNo + "20170613134813" 
					+ "意真金融" + tradeCode;
			String sign = Hashing.md5().hashString(hashString, Charsets.UTF_8).toString();
			
			
			String s = " {\"accountManageAmount\": 0,"+
				    "\"accountManageRate\": 0,"+
				    "\"advancedRepaymentRate\": 0,"+
				    "\"applyTime\": \"20170613134814\","+
				    "\"auditMap\": ["+
				    "    {"+
				    "        \"auditDate\": \"20170613134814\","+
				    "        \"auditType\": \"通过\""+
				    "    }"+
				    "],"+
				    "\"bankMap\": {"+
				     "   \"bankName\": \"中国农业银行\","+
				    "    \"cardNo\": \"6228480038780777777\""+
				    "},"+
				    "\"companyName\": \"意真金融\","+
				    "\"custMap\": {"+
				       " \"credentialsCode\": \"370126199009090035\","+
				       " \"credentialsType\": \"身份证\","+
				       " \"custCode\": \"yz0000001\","+
				       " \"custName\": \"贾立义\","+
				       " \"education\": \"暂无\","+
				      "  \"marriage\": \"暂无\","+
				     "   \"mobile\": \"18353165952\""+
				    "},"+
				    "\"loanAmount\": 1000,"+
				    "\"loanDesc\": \" test-意真21216\","+
				    "\"loanNo\": \""+loanNo+"\","+
				    "\"loanTerm\": 21,"+
				    "\"loanType\": \"善真贷\","+
				    "\"monthlyManageAmount\": 0,"+
				    "\"monthlyManageRate\": 0,"+
				    "\"overdueRepaymentRate\": 0,"+
				    "\"repaymentCycle\": 1,"+
				    "\"repaymentList\": ["+
				        "{"+
				           " \"advanceCleanupTotalAmount\": 1000,"+
				          "  \"currentTerm\": 1,"+
				         "   \"expectRepaymentDate\": \"20170627\","+
				        "    \"repaymentInterest\": 0,"+
				       "     \"repaymentPrincipal\": 1000,"+
				      "      \"repaymentTotalAmount\": 1000"+
				     "   }"+
				    "],"+
				    "\"repaymentMethod\": \"到期还本付息\","+
				    "\"requestTime\": \"20170613134813\","+
				    "\"sign\": \""+sign+"\","+
				    "\"termUnit\": \"天\","+
				    "\"tradeCode\": \""+tradeCode+"\","+
				    "\"yearIrr\": 0,"+
				    "\"interfaceType\": \"保存优选项目\"}";
//			System.out.println(s);
			String result = HttpUtil.sendPostUrl("http://localhost:8084/openservice/saveProject",s, "utf-8");
//			System.out.println(loanNo + "|" +result);
			
			result1 += loanNo + ",";
		}
		System.out.println(result1 );
		
	}

}
